import time

from selenium import webdriver
from selenium.webdriver.common.by import By

class LoginOperation:
    def login(self, driver, username, password):
        driver.find_element(By.ID, "username").send_keys(username)
        driver.find_element(By.ID, "password").send_keys(password)
        driver.find_element(By.ID, "login_btn").click()
        time.sleep(1)


    def get_success_result(self, driver):
        result = driver.title
        return result

    def get_error_name(self, driver):
        result = driver.find_element(By.XPATH,"/html/body/div/div/div/form/div[1]/span[1]").text
        return result

    def get_error_pwd(self, driver):
        result = driver.find_element(By.XPATH,"/html/body/div/div/div/form/div[2]/span[1]").text
        return result

    def get_error_result1(self, driver):
        result = driver.page_source
        return result






